home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / usr / share / laptop-mode-tools / modules / video-out < prev    next >
Encoding:
Text File  |  2012-05-20  |  1.2 KB  |  48 lines

  1. #! /bin/sh
  2. # Laptop mode tools module: selectively disable video outputs
  3. #
  4.  
  5. do_xrandr () {
  6.       w -hs | while read -r USER TTY DISPLAY REMAINDER; do    
  7.           if [ "${DISPLAY#:}" != "$DISPLAY" ] ; then
  8.               # It's an X display.
  9.               if su $USER -c "xrandr --output $1 --$2" | grep -q display ; then
  10.                 log "VERBOSE" "Unable to set video output $1 to $2."
  11.             else 
  12.                 log "VERBOSE" "Set video output $1 to $2"
  13.             fi
  14.         fi
  15.         done
  16. }
  17.  
  18. if [ x$CONTROL_VIDEO_OUTPUTS = x1 ] ; then
  19.     if [ $ON_AC -eq 1 ]; then
  20.         if [ "$ACTIVATE" -eq 1 ]; then
  21.             DISABLE_VIDEO_OUTPUTS="$LM_AC_DISABLE_VIDEO_OUTPUTS"
  22.         else
  23.             DISABLE_VIDEO_OUTPUTS="$NOLM_AC_DISABLE_VIDEO_OUTPUTS"
  24.         fi
  25.     else
  26.         DISABLE_VIDEO_OUTPUTS="$BATT_DISABLE_VIDEO_OUTPUTS"
  27.     fi
  28.  
  29.     if [ -f /var/run/laptop-mode-tools/disabled-video-outputs ] ; then
  30.         cat /var/run/laptop-mode-tools/disabled-video-outputs |
  31.             while read VIDEO_OUTPUT REMAINDER ; do
  32.                 do_xrandr $VIDEO_OUTPUT auto
  33.             done
  34.     fi
  35.             
  36.     rm -f /var/run/laptop-mode-tools/disabled-video-outputs
  37.     
  38.     for VIDEO_OUTPUT in $DISABLE_VIDEO_OUTPUTS ; do
  39.         echo $VIDEO_OUTPUT >> /var/run/laptop-mode-tools/disabled-video-outputs
  40.         
  41.         do_xrandr $VIDEO_OUTPUT off
  42.     done
  43. else
  44.     log "VERBOSE" "video-out module is disabled."
  45. fi
  46.  
  47.